package com.google.code.yargon.engine;

import org.apache.log4j.Logger;

import com.google.code.yargon.util.LogUtil;

/**
 * Random value generator, with from-to valuerange
 * 
 *	@author Tuomas Oinonen
 */

public class RandGen {
	private static Logger log = LogUtil.getInstance();
	protected static int randBtw(int fromSeed, int toSeed) {
		// Minor check  
		if (fromSeed > toSeed) {
			log.debug("Warning! Please check 'from->to' rand values.\nNow they are from "
							+ fromSeed
							+ " to "
							+ toSeed
							+ "\n(Should be other way around?)");
		}

		int end = toSeed - fromSeed + 1;
		return (int) (Math.random() * end + 1 + toSeed - end);
	}
}
